<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in" ref="dialogBox">
      <div class="cornerComment-in-title">
        <!--        type 0 学生 2 职工-->
        <span>招生报名明细</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <!--本体列表，数据 -->
        <div class="table-body">
          <div class="table-body-box">
            <el-table
                ref="multipleTable"
                :data="arryList"
                :stripe="tableStripe"
                :border="tableBorder"
                :height="tableHeight"
                tooltip-effect="dark"
                style="width: 100%"
                header-cell-class-name="table-text-c"
                cell-class-name="table-text-c">
              <el-table-column
                  prop="id"
                  label="ID"
                  width="60"
                  :key="1">
              </el-table-column>
              <el-table-column
                  prop="name"
                  label="学生姓名"
                  :key="3">
              </el-table-column>
              <el-table-column
                  prop="mobile_phone"
                  label="父母电话"
                  :key="4">
              </el-table-column>
              <el-table-column
                  prop="address"
                  label="户籍地"
                  :key="5">
              </el-table-column>
              <el-table-column
                  prop="create_time"
                  label="报名时间"
                  :key="6">
              </el-table-column>
              <el-table-column
                  prop="address"
                  label="预报班级"
                  :key="7">
                <template slot-scope="scope">
                  {{scope.row.class_name?scope.row.class_name: ''}}
                </template>
              </el-table-column>
              <el-table-column
                  label="带看人"
                  width="160"
                  :key="8">
                <template slot-scope="scope">
                  {{scope.row.user?scope.row.user.realname: ''}}
                </template>
              </el-table-column>
              <el-table-column
                  prop="create_time"
                  label="状态"
                  width="160"
              :key="9">
                <template slot-scope="scope">
                  <span v-if="scope.row.status!=='待接待'">
                    {{`已接待${scope.row.is_examine?'/'+(scope.row.is_examine==1?'通过':'驳回'):''}`}}
                  </span>
                  <span v-else>
                    待接待
                  </span>
                </template>
              </el-table-column>
              <el-table-column
                  label="操作"
                  width="140"
                  :key="10">
                <template slot-scope="scope">
                  <el-button size="small" @click="detailId=scope.row.id,detailVisible=true">查看详情</el-button>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <!--工具条 分页-->
        <el-col :span="24" class="toolbar">
          <el-pagination
              background
              :page-size="page.pagesize"
              :current-page="page.pageindex"
              layout="total, prev, pager, next"
              :total="page.total"
              @current-change="handleSizeChange"></el-pagination>
        </el-col>
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click="closePOpup" size="small">确定</el-button>
      </div>
    </div>
    <recruitDetail :visible.sync="detailVisible" :recruitId="detailId"></recruitDetail>
  </div>
</template>

<script>
import {pagination} from '@/utils/util.js'
import {recuitLogIndex} from '@/api/admin/recuit'
import recruitDetail from "./recruitDetail";

export default {
  props: ['visible', 'recruitId'], // commoent 学生点评 collection 学生采集
  components: {recruitDetail},
  data() {
    return {
      healthId: 0,
      dialogVisible: this.visible,
      tableStripe: true, // 是否斑马栏
      tableBorder: true, // 单元格右边边框
      arryList: [], // 数据列表
      // 页数
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
      tableHeight: 0,
      detailId: 0,
      detailVisible: false
    }
  },
  watch: {
    visible() {
      if (this.visible) {
        let n = this;
        this.$nextTick(() => {
          let height = n.$refs.dialogBox.offsetHeight;  //top 50 1 search 50 page 50 10 footer 50 1
          this.tableHeight = height - (51 + 20 + 50 + 51)
        })
        this.InitFn()
      } else {
        this.arryList = [];
      }
      this.dialogVisible = this.visible
    }
  },
  created() {
  },
  methods: {
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    // 初始化
    async InitFn() {
      let option = {}
      option.p = this.page.pageindex
      option.recruit_id = this.recruitId
      recuitLogIndex(option).then(res => {
        if (!res.code) {
          for (let item of res.list.data) {
            // item.examine_time = item.examine_time?item.examine_time.split(' ')[0]: ''
            // item.time = item.time.split(' ')[0]
            item.create_time = item.create_time.split(' ')[0]
          }
          this.arryList = res.list.data
          this.page.total = res.list.total
        }
      })
    },
    handleSizeChange(val) {
      this.page.pageindex = val
      this.InitFn()
    }
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 80%;
  height: 70%;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

.toolbarLine {
  text-align: center;
}

.hearder-search {
  display: flex;
  align-items: center;
}

.breadcrumb-container {
  margin-bottom: 10px;
}
</style>


